Repository navigation
feat(aggregator): global search slice 2 — registry, DNS, services, tier items (#1212) - #7331
Conversation
…er items (#1212) Search (slice 1, PR #3969) covered only board and roadmap subjects. Slice 2 extends searchWork with the registry/session records, the DNS register, the usage-hub services, and the orchestration tier items, each result carrying a stable detail href: /item/<id> for board/roadmap, /sessions?id=<id>#<id> for sessions, /dns#dns-<domain> for register rows (dnsTable now renders a per-domain anchor), /quota/service/<id> for services, and the session view or the /discuss/<object> page for tier items. renderSearch links each card to its own detail view and carries the freshness facets of every result kind home page; searchContext loads the extra sources fail-soft so one broken source never takes search down. Refs #1212 (slice 2 of the issue acceptance; does not close it).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f784279442
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| id: item.id, | ||
| title: item.title, | ||
| summary: `${item.source} · ${item.state ?? item.kind}`, | ||
| refs: item.ref ? [item.ref] : [], |
There was a problem hiding this comment.
Validate tier refs before exposing them as GitHub badges
When a matching tier item carries a tracked-goal ID such as goal_b647ff5c92f5 in ref, this passes it to renderSearch, whose unresolved-badge path calls refUrl(ref) unconditionally. parseRef then throws, causing the entire /search request to fail. This is a supported input: tierItemCard already guards non-GitHub refs with isValidRef, and test/dashboard-overhaul.test.ts covers that exact goal ID. Filter these values out of the GitHub badge refs or render them as plain text.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0ba2dc9 (task 12609, lane code-e): searchWork now filters tier (and registry) refs with isValidRef before they become badge refs, so a tracked-goal id like goal_b647ff5c92f5 never reaches refUrl; renderSearch also renders any non-GitHub ref that still arrives as a plain-text badge instead of a refUrl link (defense in depth). Regression tests in search-view.test.ts cover both layers.
| const tierItems = orchestration ? [...orchestration.tiers.needsDrew, ...orchestration.tiers.needsOrchestrator] : []; | ||
| const extras = { registry, dns, services: usage?.services ?? [], tierItems }; | ||
| return { query, results: searchWork(board, rows, items, query, extras), items }; |
There was a problem hiding this comment.
Resolve refs from the newly added search sources
When a registry session or tier item references a GitHub issue that is absent from the board and roadmap, its search badge always renders as unresolved, even if the live project pool or projector can resolve it. searchContext still requests source.items() only for board/roadmap refs, and the live implementation returns only the requested refs, so the new results never receive their projected state. Include registry taskRefs and valid tier-item refs in the resolution set before constructing the results.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0ba2dc9 (task 12609, lane code-e): searchContext now adds registry taskRefs and valid tier-item refs to the resolution set passed to source.items(), so badges for refs carried only by the slice-2 sources resolve against the live pool/projector instead of always rendering unresolved.
| .map( | ||
| (e) => | ||
| `<tr${e === nextRenewal ? ' id="dns-next-renewal"' : ""} data-dns-row data-dns-status="${esc(e.status)}" data-dns-renewing-soon="${renewingSoon.has(e)}"><td><strong>${esc(e.domain)}</strong></td><td>${esc(e.renewal)}</td><td>${e.priceUsd != null ? `$${e.priceUsd.toFixed(2)}` : "—"}</td><td>${esc(e.autoRenew)}</td><td>${esc(e.plan)}</td><td>${esc(e.review)}</td></tr>`, | ||
| `<tr${e === nextRenewal ? ' id="dns-next-renewal"' : ""} data-dns-row data-dns-status="${esc(e.status)}" data-dns-renewing-soon="${renewingSoon.has(e)}"><td><strong id="${dnsAnchor(e.domain)}">${esc(e.domain)}</strong></td><td>${esc(e.renewal)}</td><td>${e.priceUsd != null ? `$${e.priceUsd.toFixed(2)}` : "—"}</td><td>${esc(e.autoRenew)}</td><td>${esc(e.plan)}</td><td>${esc(e.review)}</td></tr>`, |
There was a problem hiding this comment.
Escape the domain-derived DNS anchor attribute
When a register/feed entry contains HTML metacharacters in its domain, the new anchor interpolates them directly into a quoted attribute. dnsAnchor only lowercases its input, while isDnsSection accepts any string domain and the register parsers do not enforce hostname syntax. An otherwise valid entry with domain x"><img src=x onerror=alert(1)> therefore injects executable markup into /dns; previously the domain was rendered only through esc(e.domain). Apply esc to the generated anchor before inserting it into HTML.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0ba2dc9 (task 12609, lane code-e): the /dns row anchor now renders as id="${esc(dnsAnchor(e.domain))}", so a domain carrying HTML metacharacters cannot break out of the attribute. Regression test renders a register whose domain is x"> and asserts the escaped anchor.
| record.model, | ||
| record.directory, |
There was a problem hiding this comment.
Guard optional search fields before lowercasing them
When an accepted registry record contains a non-string optional field such as model: 7, a query that does not match an earlier field reaches this value in includesQuery and throws because value?.toLowerCase() only guards against nullish values. isSessionRecord does not validate optional model, title, or directory, so these values can survive ingestion even though the existing sessions renderer safely escapes them. The new DNS matching path has the same problem with fields such as registrar, whose type isDnsSection does not check. One such record therefore breaks both /search and /api/search.json, despite the source-fetch failure handlers. Check that searchable values are strings or sanitize these fields before matching.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0ba2dc9 (task 12609, lane code-e): includesQuery now only matches values that are actually strings (typeof check), so a non-string optional field (registry model: 7, a numeric DNS registrar) is skipped instead of throwing on .toLowerCase(). Regression tests cover both the registry and DNS matching paths.
P1: tier/registry refs are filtered with isValidRef before they become GitHub badges, and renderSearch renders a non-GitHub ref as plain text instead of letting refUrl throw and fail /search. P2: searchContext resolves refs carried only by registry sessions and tier items. P2: the /dns row anchor id is escaped. P2: includesQuery only matches string values, so non-string optional fields (model: 7, a numeric registrar) no longer throw. Regression tests for each finding in search-view.test.ts.
Summary
Implements slice 2 of issue #1212 (queue task 12609), scoped to the remainder confirmed by triage task 11920. Slice 1 (PR #3969, merged) gave /search board+roadmap only; this PR adds the remaining subjects and detail links.
Refs #1212 — this is slice 2 of its acceptance, not a close: the issue stays open for any remaining verification.
Tests
Merge Danger
Door: two-way (additive search subjects + one anchor attribute per DNS row). Blast radius: /search and /api/search.json only, plus a rendered id attribute on /dns rows.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.